<template>
  <el-container class="layout-container">
    <el-aside width="280px" height="100vh">
      <div class="sidebar">
        <h2>企业内部管理系统</h2>
        <nav>
          <ul>
            <!-- 管理员菜单 -->
            <template v-if="isAdmin">
              <li class="fixed-menu-item">
                <router-link to="/home/admin/employeeManage">课程管理</router-link>
              </li>
              <li class="fixed-menu-item">
                <router-link to="/home/admin/employeeManagement">员工管理</router-link>
              </li>
              <li class="fixed-menu-item">
                <router-link to="/home/admin/trainingManagement">培训报名管理</router-link>
              </li>
              <!-- <li class="fixed-menu-item">
                <router-link to="/home/admin/trackManagement">培训跟踪</router-link>
              </li> -->
              <li class="fixed-menu-item">
                <router-link to="/home/admin/feedbackManagement">课程反馈</router-link>
              </li>
            </template>
            <!-- 普通用户菜单 -->
            <template v-else>
              <li class="fixed-menu-item">
                <router-link to="/home/employee/course">课程中心</router-link>
              </li>
<!--               <li class="fixed-menu-item">
                <router-link to="/home/employee/feedback">课程反馈</router-link>
              </li> -->
              <!-- <li class="fixed-menu-item">
                <router-link to="/home/employee/progress">课程进度</router-link>
              </li> -->
              <li class="fixed-menu-item">
                <router-link to="/home/employee/user">用户信息</router-link>
              </li>
            </template>
          </ul>
        </nav>
      </div>
    </el-aside>

    <el-container>
      <el-header class="header">
        <Header />
      </el-header>

      <el-main class="main">
        <router-view></router-view>
      </el-main>
    </el-container>
  </el-container>
</template>

<script setup>
import Header from '../components/Layout/Header.vue'
import store from '../store'
import { computed } from 'vue'

const isAdmin = computed(() => store.getters.isAdmin)
</script>

<style scoped>
.layout-container {
  background-color: #f0f4f8;
  height: 100vh;
  overflow: hidden;
}

.side-menu {
  height: 100%;
  border-right: 2px solid #b0c4de;
  background-color: #e0f7fa;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.05);
}

.header {
  background-color: #ffffff;
  border-bottom: 2px solid #42b883;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
  height: 60px;
  line-height: 60px;
  padding: 0 20px;
  position: relative;
  z-index: 1;
}

.main {
  padding: 20px;
  background-color: #ffffff;
  overflow-y: auto;
  height: calc(100vh - 60px);
}

:deep(.el-menu-item) {
  height: 50px;
  line-height: 50px;
  color: #ffffff;
}

:deep(.el-menu-item:hover) {
  background-color: #1c2541 !important;
  color: #ffffff !important;
}

:deep(.el-menu-item.is-active) {
  background-color: #3a506b;
  color: #ffffff;
}

:deep(.router-link-active) {
  color: #1c2541;
  text-decoration: none;
}

:deep(.el-sub-menu__title) {
  height: 50px;
  line-height: 50px;
}

:deep(.router-link-active) {
  width: 100%;
  display: block;
}

.el-menu-item-group__title {
  background-color: #e0f7fa;
  padding: 0;
}

.fixed-menu-item {
  background-color: #2c3e50;
  color: #ffffff;
  margin: 1.5rem 0;
  padding: 12px 20px;
  cursor: pointer;
  border-left: 4px solid transparent;
  transition: all 0.3s ease;
  border-radius: 4px;
}

.fixed-menu-item:hover {
  background-color: #1c2541;
  border-left-color: #42b883;
  transform: translateX(5px);
}

.el-menu {
  margin: 0;
  padding: 0;
}

.el-menu--inline {
  margin: 0;
  padding: 0;
}

.el-menu-item-grop {
  margin: 0;
  padding: 0;
  background-color: #e0f7fa;
}

.el-menu-item-group__title {
  background-color: #e0f7fa;
  padding: 0;
}

.sidebar {
  background-color: #2c3e50;
  padding: 20px;
  color: #ffffff;
  height: 100%;
  overflow-y: auto;
  box-sizing: border-box;
}

.sidebar h2 {
  color: #42b883;
  margin-bottom: 2rem;
  font-size: 1.5rem;
  text-align: center;
}

.sidebar ul {
  list-style-type: none;
  padding: 0;
  margin-top: 2rem;
}

.sidebar li {
  margin: 10px 0;
  cursor: pointer;
}

.sidebar li.active {
  background-color: rgba(66, 184, 131, 0.1);
  border-left: 4px solid #42b883;
}

.sidebar li:hover {
  background-color: #1c2541;
  color: #ffffff;
}

.sidebar .fixed-menu-item a {
  color: #ffffff !important;
  text-decoration: none;
  font-size: 1.1rem;
  display: block;
}

.sidebar .fixed-menu-item a.router-link-active {
  color: #42b883 !important;
  font-weight: 600;
}

</style>